home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / gcc / ixemsrc.lha / ixemul / static / vfork_setup_child.c < prev   
Encoding:
C/C++ Source or Header  |  1996-08-14  |  669 b   |  31 lines

  1. extern void ix_get_variables(int);  /* from crt0.c! */
  2. extern void ix_resident();
  3. extern int __datadata_relocs();
  4.  
  5. static inline unsigned int get_a4(void)
  6. {
  7.   unsigned int res;
  8.  
  9.   asm ("movel a4,%0" : "=g" (res));
  10.   return res;
  11. }
  12.  
  13. static inline int dbsize(void)
  14. {
  15.   int res;
  16.  
  17.   asm ("movel #___data_size,%0; addl #___bss_size,%0" : "=r" (res));
  18.   return res;
  19. }
  20.  
  21. void vfork_setup_child(void)
  22. {
  23.   /* this re-relocates the data segment */
  24.   ix_resident(4, get_a4(), dbsize(), __datadata_relocs);
  25.  
  26.   /* pass the new addresses for internal variables (e.g. errno) to
  27.      ixemul. Pass '1' to tell ix_get_variables that it is called from
  28.      here */
  29.   ix_get_variables(1);
  30. }
  31.